﻿using System;
using System.Configuration.Provider;

namespace Avaxo.Scripting
{
    public sealed class LanguageEngineCollection : ProviderCollection
    {
        public override void Add( ProviderBase provider )
        {
            if ( provider == null )
            {
                throw new ArgumentNullException( "provider" );
            }
            if ( !( provider is ILanguageEngine ) )
            {
                throw new ArgumentException( "Provider must implement type " + typeof ( ILanguageEngine ), "provider" );
            }

            base.Add( provider );
        }

        public new ILanguageEngine this[ string name ]
        {
            get { return (ILanguageEngine) base[ name ]; }
        }
    }
}